﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Unity.Game.ElisAdvance.ElisScript
{
    public class ElisState_Sit
    {
        public static void onFixedProc(ElisActiveObject activeObject, float horiztantlKey)
        {
            if (activeObject.getStateVector(0) == 0)
            {
                if (activeObject.getStateTimer() > 0.25f && !KeyPressEvent.isKeyPressDown())
                {
                    activeObject.clearStateVector();
                    activeObject.setState(State.STATE_STAND);
                }
            }
            else if (activeObject.getStateVector(0) == 1)
            {
                if (activeObject.getStateTimer() > 0.05f)
                {
                    activeObject.clearStateVector();
                    activeObject.setState(State.STATE_STAND);
                }
            }

        }

        public static void onProc(ElisActiveObject activeObject)
        {


        }

        public static void onSetState(ElisActiveObject activeObject)
        {
            activeObject.getGravityEvent().setEnable(false);
            if (activeObject.getStateVector(0) == 0)
            {
                activeObject.getVar("GLOBAL_horiztantlKey").clear_vector();
                activeObject.getAniManager().setAni("Sit");
                activeObject.setXVelocity(0.0f);
                activeObject.setYVelocity(0.0f);
            }
            else if (activeObject.getStateVector(0) == 1)
            {
                activeObject.getVar("GLOBAL_horiztantlKey").clear_vector();
                activeObject.getAniManager().setAni("Sit");
                activeObject.setXVelocity(0.0f);
                activeObject.setYVelocity(0.0f);
            }
        }
    }
}
